<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8"/>
    <title>分配权限 - bjyadmin</title>
    <link href="/Public/static/admin/css/bootstrap.min.css" rel="stylesheet">
    <link href="/Public/static/admin/css/font-awesome.css" rel="stylesheet">
    <link href="/Public/static/admin/css/animate.css" rel="stylesheet">
    <link href="/Public/static/admin/css/style.css" rel="stylesheet">
    <link href="/Public/static/admin/css/plugins/treeview/bootstrap-treeview.css" rel="stylesheet">
</head>
<body>
<h1 class="text-center">为<span style="color:red"><?php echo ($group_data['title']); ?></span>分配权限</h1>
<form action="" method="post">
    <input type="hidden" name="id" value="<?php echo ($group_data['id']); ?>">
    <table class="table table-striped table-bordered table-hover table-condensed
	">
        <?php if(is_array($rule_data)): foreach($rule_data as $key=>$v): if(empty($v['_data'])): ?><tr class="b-group">
                    <th width="10%">
                        <label>
                            <?php echo ($v['title']); ?>
                            <input type="checkbox" name="rule_ids[]" value="<?php echo ($v['id']); ?>" <?php if(in_array($v['id'],$group_data['rules'])): ?>checked="checked"<?php endif; ?> onclick="checkAll(this)" >
                        </label>
                    </th>
                    <td></td>
                </tr>
                <?php else: ?>
                <tr class="b-group">
                    <th width="10%">
                        <label>
                            <?php echo ($v['title']); ?> <input type="checkbox" name="rule_ids[]" value="<?php echo ($v['id']); ?>" <?php if(in_array($v['id'],$group_data['rules'])): ?>checked="checked"<?php endif; ?> onclick="checkAll(this)">
                        </label>
                    </th>
                    <td class="b-child">
                        <?php if(is_array($v['_data'])): foreach($v['_data'] as $key=>$n): ?><table class="table table-striped table-bordered table-hover table-condensed">
                                <tr class="b-group">
                                    <th width="10%">
                                        <label>
                                            <?php echo ($n['title']); ?> <input type="checkbox" name="rule_ids[]" value="<?php echo ($n['id']); ?>" <?php if(in_array($n['id'],$group_data['rules'])): ?>checked="checked"<?php endif; ?> onclick="checkAll(this)">
                                        </label>
                                    </th>
                                    <td>
                                        <?php if(!empty($n['_data'])): if(is_array($n['_data'])): $i = 0; $__LIST__ = $n['_data'];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$c): $mod = ($i % 2 );++$i;?><label>
                                                    &emsp;<?php echo ($c['title']); ?> <input type="checkbox" name="rule_ids[]" value="<?php echo ($c['id']); ?>" <?php if(in_array($c['id'],$group_data['rules'])): ?>checked="checked"<?php endif; ?> >
                                                </label><?php endforeach; endif; else: echo "" ;endif; endif; ?>
                                    </td>
                                </tr>
                            </table><?php endforeach; endif; ?>
                    </td>
                </tr><?php endif; endforeach; endif; ?>
        <tr>
            <th></th>
            <td>
                <input class="btn btn-success" type="submit" value="提交">
            </td>
        </tr>
    </table>
</form>
<script src="/Public/static/admin/js/jquery.min.js?v=2.1.4"></script>
<script src="/Public/static/admin/js/bootstrap.min.js?v=3.3.6"></script>
<script src="/Public/static/admin/js/content.js?v=1.0.0"></script>
<script src="/Public/static/admin/js/plugins/treeview/bootstrap-treeview.js"></script>
<script>
    function checkAll(obj){
        $(obj).parents('.b-group').eq(0).find("input[type='checkbox']").prop('checked', $(obj).prop('checked'));
    }
</script>
</body>
</html>